#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <iostream>
using namespace std;
const int maxn = 400010;
int sum[maxn], a[maxn], ans[maxn], N, tot;
struct in {
  int x;
  int y;
  int id;
  friend bool operator<(in & a, in& b) {
    if (a.y == b.y) return a.x > b.x;
    return a.y < b.y;
  }
} s[maxn];
void add(int x) {
  while (x <= tot) {
    sum[x]++;
    x += (-x) & x;
  }
}
int query(int x) {
  int res = 0;
  while (x) {
    res += sum[x];
    x -= (-x) & x;
  }
  return res;
}
int main() {
  scanf("%d", &N);
  for (int i = 1; i <= N; i++) {
    scanf("%d%d", &s[i].x, &s[i].y);
    s[i].id = i;
    a[++tot] = s[i].x;
    a[++tot] = s[i].y;
  }
  sort(a + 1, a + tot + 1);
  tot = unique(a + 1, a + tot + 1) - (a + 1);
  sort(s + 1, s + N + 1);
  for (int i = 1; i <= N; i++) {
    int tx = lower_bound(a + 1, a + tot + 1, s[i].x) - a;
    int ty = lower_bound(a + 1, a + tot + 1, s[i].y) - a;
    ans[s[i].id] = query(ty) - query(tx - 1);
    add(tx);
  }
  for (int i = 1; i <= N; i++) printf("%d\n", ans[i]);
  return 0;
}
